"""
五子棋模块配置模块

包含五子棋游戏的特定配置设置，与主应用配置分离。
"""

from typing import Dict, Any
from pydantic import BaseModel

from app.core.config import settings as app_settings


class GomokuSettings(BaseModel):
    """五子棋模块特定配置"""
    
    # 模块通用配置
    MODULE_NAME: str = "Gomoku Online"
    API_PREFIX: str = "/gomoku"
    
    # 游戏规则配置
    BOARD_SIZE: int = 15  # 标准棋盘大小15x15
    WIN_CONDITION: int = 5  # 五子连珠获胜
    
    # 匹配系统配置
    MATCH_EXPIRY_SECONDS: int = 30  # 匹配超时时间
    RATING_RANGE_INITIAL: int = 200  # 初始匹配评分范围
    RATING_RANGE_INCREMENT: int = 50  # 每次匹配评分范围增加值
    RATING_RANGE_MAX: int = 500  # 最大匹配评分范围
    
    # 对战配置
    GAME_MOVE_TIMEOUT_SECONDS: int = 60  # 每步棋超时时间
    
    # WebSocket配置
    WS_URL_PREFIX: str = "/ws/gomoku"
    
    # 拓展项
    default_starting_rating: int = 1200  # 默认起始评分
    min_games_for_ranking: int = 5  # 最少需要多少场游戏才能进入排行榜
    
    def get_full_api_prefix(self) -> str:
        """获取包含API版本的完整API前缀"""
        return f"{app_settings.API_V1_STR}{self.API_PREFIX}"
    
    def get_full_ws_prefix(self) -> str:
        """获取完整WebSocket前缀"""
        return self.WS_URL_PREFIX


# 创建五子棋配置实例
settings = GomokuSettings() 